package com.guanyong.www.controllers.page;

import com.guanyong.model.MaoyanMovieModel;
import com.guanyong.services.CommentService;
import com.guanyong.services.MaoyanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;


/**
 * Created by Eric.Zhang on 2017/4/12.
 */
@Controller
public class home {
    @Autowired
    CommentService commentService;
    @Autowired
    MaoyanService maoyanService;

//    @RequestMapping({"/", "/home", "/home/index"})
    @RequestMapping({ "/movie"})
    String index(HttpServletRequest request) {


        return "/home/index";
    }
    @RequestMapping({"/test"})
    String test() {

        return "home/test";
    }

    @RequestMapping({"/pc"})
    String pc() {

        return "home/pc";
    }
    @RequestMapping({"/phone"})
    String phone() {

        return "home/phone";
    }

    @RequestMapping({"/welcome"})
    String welcome() {

        return "home/welcome";
    }
    @RequestMapping({"/movieIndex"})
    String movieIndex() {

        return "home/movieIndex";
    }
    @RequestMapping({"/share"})
    String share() {
        return "home/share";
    }


//    @RequestMapping({"/maoyanindex"})
    @RequestMapping({"/moviePC"})
    String maoyanindex() {
        return "home/maoyan/index";
    }

//    @RequestMapping({"/mmaoyanindex"})
    @RequestMapping({"/movieH5"})
    String mmaoyanindex() {
        return "home/mmaoyan/index";
    }


    @RequestMapping({"/houtai"})
    String maoyanhoutai() {
        return "home/maoyan/houtai";
    }


    @RequestMapping({"/maoyandetails"})
    String maoyandetails(Model model, HttpServletRequest request) {
        String movieid=request.getParameter("movieid");
        if (movieid!=null && movieid!=""){
//
//            Integer movieidN=Integer.parseInt(movieid);
//            MaoyanMovieModel maoyanMovieModel=maoyanService.GetMaoyanByMovieMovieId(movieidN);
//            model.addAttribute("movieinfo",maoyanMovieModel);
            return "home/maoyan/details";
        }
        else{
            return "home/maoyan/index";
        }


    }


    @RequestMapping({"/mmaoyandetails"})
    String mmaoyandetails(Model model, HttpServletRequest request) {
        String movieid=request.getParameter("movieid");
        if (movieid!=null && movieid!=""){
//
//            Integer movieidN=Integer.parseInt(movieid);
//            MaoyanMovieModel maoyanMovieModel=maoyanService.GetMaoyanByMovieMovieId(movieidN);
//            model.addAttribute("movieinfo",maoyanMovieModel);
            return "home/mmaoyan/details";
        }
        else{
            return "home/mmaoyan/index";
        }


    }
}
